<?php 

/**
 * NOTICE OF LICENSE
 *
 * THIS SOURCE FILE IS PART OF EVEBIT'S PRIVATE PROJECT.
 * 
 * DO NOT USE THIS FILE IN OTHER PLACE.
 *
 * @category    ChinaWanderer
 * @package     Blocks
 * @subpackage  Template
 * @author      Chen Qiao <chen.qiao@evebit.com>
 * @version     $$Id: header.phtml 127 2011-03-17 10:22:06Z chen.qiao $$
 * @copyright   Copyright (c) 2011 Evebit Inc. China (http://www.evebit.com)
 */

if($this->module) {
	$module = $this->module;
} else {
	$module = 'backend/';
}
?>

   
   <thead>
     <tr class="headings">
     	<?php $i=0;?>
     	<?php foreach ($this->colnums as $field_key=>$lable):?>
     		<th class="<?php echo (isset($this->state["filters"][$field_key]))?'':'no-link' ?><?php echo (count($this->colnums)==($i+1))?' last':'' ?>" >
     			<?php $field=@$this->state["filters"][$field_key];?>
     			   <?php if(isset($this->state["filters"][$field_key])):?>
     			   
     					<a class="<?php echo $this->getSortClass($this->state["sort"],$field_key)?>"   href="<?php echo $this->getSortLink($this->state["sort"],$field_key) ?>">
     					<img alt="" src="<?php echo $this->baseUrl("media/assets/bg.gif")?>">
     					<?php echo $lable; ?>
     					</a>     					
     				<?php else:?>
     				<?php if($lable=="&nbsp;"):?>	
     					<input type="checkbox" class="checkall" />	
     				<?php endif;?>	
     				<?php endif;?>
     			
     		</th>
     		
     	<?php $i++;?>
     	<?php endforeach;?>     	 
     </tr>
     <?php if($this->showfilter || $this->showfilter === NULL):?>
     <tr class="filter">
     	<?php $i=0;?>
     	<?php foreach($this->colnums as $field_key=>$lable):?>     	
     		<?php if (isset($this->state["filters"][$field_key])):?>
     		<?php $field=$this->state["filters"][$field_key];?>
     		<td  class=<?php echo (count($this->colnums)==($i+1))?' last':'' ?> >
     			<?php if($field['type'] == 'int'):?>
     			
             			<span class="label"><?php echo $this->__("From : ") ?></span> 
             			<input size="5" type="text"  name="filter[<?php echo $field_key ?>][from]" value="<?php echo @$field['data']["from"] ?>" />
             		<div style="margin-top:3px;">
             			<span class="label" ><?php echo $this->__("&nbsp;&nbsp;&nbsp;&nbsp;To : ") ?></span>
             			<input size="5" type="text"  name="filter[<?php echo $field_key ?>][to]" value="<?php echo @$field['data']["to"] ?>" />
</div>
             		
     			<?php elseif($field['type'] == 'string'):?>
     			<div class="range-line">
     				<input type="text" size="10" class="input-text no-changes" name="filter[<?php echo $field_key ?>][like]" 	value="<?php echo @$field['data']['like'] ?>" />
     			</div>
     			<?php elseif($field['type'] == 'select'):?>
     			<div class="range-line">
     				<select class="input-select no-changes" onchange="$('#<?php echo $this->viewAtion; ?>_form').submit();" name="filter[<?php echo $field_key ?>]">
     					<option <?php echo !@$field['data']?'selected':''?> value="">&nbsp;</option>
     					<?php foreach ($field['options'] as $k=>$v):?>
     						<option <?php echo $k==@$field['data']?'selected':''?> value="<?php 

echo $k?>"><?php echo $v?></option>
     					<?php endforeach;?>
     				</select>
     			</div>
     			<?php elseif($field['type'] == 'date'):?>
     			<div class="range">
	     			<div class="range-line" >
	     				<span class="label"><?php echo $this->__("From : ") ?></span> 
	     				<input type="text" size="10" id="<?php echo $field_key ?>from"
								 class="input-text no-changes datepicker" readonly="readonly"  name="filter[<?php echo $field_key ?>][from]"  value="<?php echo @$field['data']['from'] ?>" />
	     			</div>
	     			<div class="range-line" style="margin-top:3px;">
	     				<span class="label"><?php echo $this->__("&nbsp;&nbsp;&nbsp;&nbsp;To : ") ?></span>
	     				<input type="text" size="10" id="<?php echo $field_key ?>to"
								 class="input-text no-changes datepicker" readonly="readonly" name="filter[<?php echo $field_key ?>][to]" value="<?php echo @$field['data']['to'] ?>" />
<script>
$(function() {
	$( "#<?php echo $field_key ?>to" ).datepicker();
	
});

$(function() {
	$( "#<?php echo $field_key ?>from" ).datepicker();

	
});





	</script>

	     			</div>
     			</div>
     			<?php endif;?>
     		</td>
     		<?php elseif($i==sizeof($this->colnums)-1):?>
     		<td>
     		<div class="meta">
						
						<ul style="margin-left:-9px;">
							<li style="margin-top:2px;"><a style="width:60px;" class="tooltip" onclick="document.getElementById('<?php echo $this->viewAction;?>_form').submit();" title="search" ><span class="ui-icon ui-icon-search"></span><?php echo $this->__("Search") ?></a></li>
							<li style="margin-top:2px;"><a style="width:60px;" class="tooltip" onclick="location.href='<?php echo $this->baseUrl();?>/<?php echo $module.$this->viewAction;?>/reset'" title="search" ><span class="ui-icon ui-icon-arrowthickstop-1-w"></span><?php echo $this->__("Reset") ?></a></li>
						</ul>	
			</div>

     	


     		</td>
     		<?php elseif($i==0):?>
     		<td>
     		
     		</td>
     		<?php else:?>
     		<td> </td>
     		<?php endif;?>
     	<?php $i++;?>
     	<?php endforeach;?>     	
     </tr>
     <?php endif;?>
   </thead>
   